package com.medical.idempotent.config;


import com.medical.idempotent.interceptor.RepeatSubmitAspect;
import com.medical.redis.utils.RedisUtil;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConfiguration;

@AllArgsConstructor
@AutoConfiguration(after = RedisConfiguration.class)
public class IdempotentConfig {

    private final RedisUtil redisUtil;

    @Bean
    public RepeatSubmitAspect repeatSubmitAspect() {
        RepeatSubmitAspect aspect = new RepeatSubmitAspect();
        aspect.setRedisUtil(redisUtil);
        return aspect;
    }
}
